<?php require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex"); 
require_once($_SERVER['DOCUMENT_ROOT']."/Modules/CJ38IJ56/modconf.mex"); 
MYTCONN(); 
$CTOT = 0;
if ($_POST['Dp_DataSource'] == 2) {
	//==========================Import Script===========================		

	
	//==========================End Import Script=======================
} else if ($_POST['Dp_DataSource'] == 1) {	
	//==========================Manual==================================
	for ($i=1;$i<=3;$i++) {
	$GET[$i]['Dp_ID'] = 0;
	$GET[$i]['Dp_Entidad'] = $_POST['OriNumero'];
	$GET[$i]['Dp_FIngreso'] = $_POST['DpDate']." 00:00:00";
	$GET[$i]['Dp_Valor'] = $_POST['Dp'.$i];
	$GET[$i]['Dp_FValor'] = date("Y-m-d H:i:s");
	$GET[$i]['Dp_Saldo'] = 0;
	$GET[$i]['Dp_Concepto'] = '';
	$GET[$i]['Dp_Cliente'] = 0;
	$GET[$i]['Dp_FactMs'] = 0;
	$GET[$i]['Dp_Factura'] = 0;
	$GET[$i]['Dp_CASE'] = 0;
	$GET[$i]['Dp_Status'] = 1;
	$GET[$i]['Dp_Currency'] = 1;
	$CTOT += $GET[$i]['Dp_Valor'];
	}
	$CARD = 3;
	//==========================End Manual==============================
}	?>
<script charset="utf-8" type="text/javascript">
$CTOT = <?php echo $CTOT;?>;
if ($CTOT != 0) { document.DpImport.Process_Confirm.disabled=false; }
disableSelection(document.getElementById("dp_rscache"));

Ext.onReady(function(){

 $elem = 230;
 var  windowWidth = 0, windowHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
	windowWidth = window.innerWidth
	windowHeight = window.innerHeight-$elem;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	windowWidth = document.documentElement.clientWidth;
	windowHeight = document.documentElement.clientHeight-$elem;
  } 

    Ext.QuickTips.init();

    var myData = [
	<?php   
	for ($i=1;$i<=$CARD;$i++) { 
	echo '['.$i.','.$GET[$i]['Dp_ID'].',\''.$GET[$i]['Dp_Entidad'].'\',\''.$GET[$i]['Dp_FIngreso'].'\',\''.$GET[$i]['Dp_FValor'].'\',\''.$GET[$i]['Dp_Valor'].'\',\''.$GET[$i]['Dp_Saldo'].'\',\''.$GET[$i]['Dp_Concepto'].'\',\''.$GET[$i]['Dp_Cliente'].'\',\''.$GET[$i]['Dp_FactMs'].'\',\''.$GET[$i]['Dp_Factura'].'\',\''.$GET[$i]['Dp_CASE'].'\',\''.$GET[$i]['Dp_Status'].'\',\''.$GET[$i]['Dp_Currency'].'\']';
		if ($i<$CARD) {
			echo ',';
		}
    } ?>
    ];

    var ds = new Ext.data.Store({
        reader: new Ext.data.ArrayReader({}, [
               {name: 'id'},
			   {name: 'Dp_ID', type: 'int'},
               {name: 'Dp_Entidad', type: 'string'},
               {name: 'Dp_FIngreso', type: 'string'},
			   {name: 'Dp_FValor', type: 'string'},
               {name: 'Dp_Valor', type: 'string'},
               {name: 'Dp_Saldo', type: 'string'},
               {name: 'Dp_Concepto', type: 'string'},
               {name: 'Dp_Cliente', type: 'string'},
			   {name: 'Dp_FactMs', type: 'string'},
               {name: 'Dp_Factura', type: 'string'},
               {name: 'Dp_CASE', type: 'string'},
               {name: 'Dp_Status', type: 'string'},
               {name: 'Dp_Currency', type: 'string'}
          ])
    });
    ds.loadData(myData);
    var colModel = new Ext.grid.ColumnModel([
        {header: "Numero", width: 80, sortable: true, locked:true, dataIndex: 'Dp_ID'},
        {header: "Tipo", width: 80, sortable: true, locked:true, dataIndex: 'Dp_Concepto'},
        {header: "Data de deposito", width: 120, sortable: true, dataIndex: 'Dp_FIngreso'},
        {header: "Data de valor", width: 120, sortable: true, dataIndex: 'Dp_FValor'},
        {header: "Origem", width: 150, sortable: true, locked:true, dataIndex: 'Dp_Entidad'},
        {header: "Cliente", width: 150, sortable: true, locked:true, align: 'right',dataIndex: 'Dp_Cliente'},
        {header: "Valor", width: 75, sortable: true, locked:true, align: 'right',dataIndex: 'Dp_Valor'},
        {header: "Saldo", width: 75, sortable: true, locked:true, align: 'right',dataIndex: 'Dp_Saldo'},
        {header: "Moeda", width: 75, sortable: true, locked:true, align: 'right',dataIndex: 'Dp_Currency'},
        {header: "Remessa", width: 75, sortable: true, locked:true, align: 'right',dataIndex: 'Dp_FactMs'},
        {header: "Remessa", width: 75, sortable: true, locked:true, align: 'right',dataIndex: 'Dp_Factura'},
        {header: "Estado", width: 75, sortable: true, locked:true, align: 'right',dataIndex: 'Dp_Status'}
    ]);

   var selmode = new Ext.grid.RowSelectionModel({});
   var Console = new Ext.grid.GridPanel({
	    ds: ds,
	    cm: colModel,
	    sm: selmode,
	    height: windowHeight,
	    border: true,
        renderTo: 'dp_rscache'
    });
		
});
</script>